function createUpdateUserView(id, username, lname, fname, email, addr, phone, role, ban) {
	$id("txtUpdateUserId").value = id;
	$id("txtUpdateUserName").value = username;
	$id("txtUpdateLastName").value = lname;
	$id("txtUpdateFirstName").value = fname;
	$id("txtUpdateEmail").value = email;
	$id("txtUpdateRole").value = role;
	var ddlRole = document.getElementById("txtUpdateRole");
	var opts = ddlRole.options.length;
	for (var i = 0; i < length; i++) {
		if (ddlRole.options[i].value == role) {
			ddlRole.selectedIndex = i;
			break;
		}
	}

	var ddlBan = document.getElementById("txtUpdateBan");
	var opts = ddlBan.options.length;
	for (var i = 0; i < length; i++) {
		if (ddlBan.options[i].value == ban) {
			ddlBan.selectedIndex = i;
			break;
		}
	}

	$id("txtUpdatePhone").value = phone;
	$id("txtUpdateAddress").value = addr;
	
	if(role=="admin"){
		$id("txtUpdateBan").setAttribute("disabled","true");
	} else {
		$id("txtUpdateBan").removeAttribute("disabled");
	}
	
	$id("btnUpdateUser").setAttribute("onclick", "onClickUpdateStaff()");
}

function onClickUpdateStaff() {
	var id = document.getElementById("txtUpdateUserId").value;
	var username = document.getElementById("txtUpdateUserName").value;
	var lname = document.getElementById("txtUpdateLastName").value;
	var fname = document.getElementById("txtUpdateFirstName").value;
	var role = document.getElementById("txtUpdateRole").value;
	var pwd = "true";
	var email = document.getElementById("txtUpdateEmail").value;
	var isBan = document.getElementById("txtUpdateBan").value;
	//var isBan = ddlIsBan.options[ddlIsBan.selectedIndex].value;
	var phone = document.getElementById("txtUpdatePhone").value;
	var address = document.getElementById("txtUpdateAddress").value;
	if (validateStaffInfo(username, lname, fname, email, pwd, role, phone, address)) {
		ajax.put({
			url : "http://localhost:8080/book-service/admin/manageStaff",
			param : {
				"txtUpdateUserId" : id,
				"txtUpdateLastName" : lname,
				"txtUpdateFirstName" : fname,
				"txtUpdatePhone" : phone,
				"txtUpdateAddress" : address,
				"txtUpdateRole" : role,
				"txtUpdateIsBan" : isBan,
				"txtEmail" : email
			},
			success : function() {
				alert("Cập nhật nhân sự có tài khoản " + username + " thành công!");
				showPage("content-manageUser");
				callServiceStaff();
			},
			failure : function(xhr) {
				if (xhr.status == 401) {
					alert("Bạn không có quyền truy cập vào trang này!\n Xin mời đăng nhập lại");
					doRequestFail();
				} else {
					alert("Có lỗi xảy ra. Xin thử lại!");
				}
			},
			abort : function(xhr) {
				callback.abort(xhr);
			}
		});
	}
}